﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.IdentityModel.Selectors;
using DBLibrary;

namespace AuthentificationService
{
    public class CustomUserNameValidator : UserNamePasswordValidator
    {
        private Customer customer = new Customer();

        public override void Validate(String userName, String password)
        {
            if (userName == null || password == null)
            {
                throw new ArgumentNullException();
            }

            customer.connect(userName, password);
            if (!customer.IsConnected)
            {
                throw new Exception("Utilisateur ou Mot de passe incorrect");
            }
        }
    }
}